package lormi.meipin.entity;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;

import lormi.meipin.dto.TrainedAddDto;
import lormi.meipin.dto.TrainedEditDto;
import lormi.meipin.exception.LMException;

public class Trained {
	
    private Integer id;

    private Integer memid;

    private String schoolname;

    private Integer education;

    private String positionclass;

    private Date begindate;

    private Date enddate;

    private Date createtime;

    private Date updatetime;
    
    public Trained(TrainedAddDto trainedAddDto) throws LMException {
		super();
		this.memid = trainedAddDto.getUserid();
		this.schoolname = trainedAddDto.getSchoolname();
		this.education = trainedAddDto.getEducation();
		this.positionclass = trainedAddDto.getPositionclass();
		this.begindate = trainedAddDto.getBeginForDate();
		this.enddate = trainedAddDto.getEndForDate();
		this.createtime = new Date();
		this.updatetime = this.createtime;
	}
    
    public Trained(TrainedEditDto trainedEditDto) throws LMException {
		super();
		this.id = trainedEditDto.getId();
		this.memid = trainedEditDto.getUserid();
		this.schoolname = trainedEditDto.getSchoolname();
		this.education = trainedEditDto.getEducation();
		this.positionclass = trainedEditDto.getPositionclass();
		this.begindate = trainedEditDto.getBeginForDate();
		this.enddate = trainedEditDto.getEndForDate();
		this.updatetime = this.createtime;
	}

	public Trained() {
		super();
	}

	public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getMemid() {
        return memid;
    }

    public void setMemid(Integer memid) {
        this.memid = memid;
    }

    public String getSchoolname() {
        return schoolname;
    }

    public void setSchoolname(String schoolname) {
        this.schoolname = schoolname == null ? null : schoolname.trim();
    }

    public Integer getEducation() {
        return education;
    }

    public void setEducation(Integer education) {
        this.education = education;
    }

    public String getPositionclass() {
        return positionclass;
    }

    public void setPositionclass(String positionclass) {
        this.positionclass = positionclass == null ? null : positionclass.trim();
    }

    @JsonFormat(pattern = "yyyy年M月d日")
    public Date getBegindate() {
        return begindate;
    }

    public void setBegindate(Date begindate) {
        this.begindate = begindate;
    }

    @JsonFormat(pattern = "yyyy年M月d日")
    public Date getEnddate() {
        return enddate;
    }

    public void setEnddate(Date enddate) {
        this.enddate = enddate;
    }

    public Date getCreatetime() {
        return createtime;
    }

    public void setCreatetime(Date createtime) {
        this.createtime = createtime;
    }

    public Date getUpdatetime() {
        return updatetime;
    }

    public void setUpdatetime(Date updatetime) {
        this.updatetime = updatetime;
    }
}